# models.py
from sqlalchemy import Column, Integer, String, Date
from sqlalchemy.ext.declarative import declarative_base

Base = declarative_base()

class TousuAll(Base):
    __tablename__ = 'tousu_all'
    id = Column(Integer, primary_key=True)
    brand = Column(String)
    bug = Column(String)
    csName = Column(String)
    dataSource = Column(String)
    detail_url = Column(String)
    grabtime = Column(Date)
    introduct = Column(String)
    model = Column(String)
    series = Column(String)
    status = Column(String)
    factoryname_unic = Column(String)
    brandname_unic = Column(String)
    familyname_unic = Column(String)
    tousu_date = Column(Date)


class CarmapTousu(Base):
    __tablename__ = 'carmap_tousu'
    id = Column(Integer, primary_key=True, autoincrement=True)
    csName = Column(String(255), comment='厂商')
    brand = Column(String(255), comment='牌子')
    series = Column(String(255), comment='车系')
    model = Column(String(255), comment='车型')
    factoryname_unic = Column(String(255), comment='车型匹配库 厂商')
    brandname_unic = Column(String(255), comment='车型匹配库 品牌')
    familyname_unic = Column(String(255), comment='车型匹配库 车系')
    factory_tag = Column(String(255), comment='车型匹配库 厂商标记')
    show_filter = Column(String(2), comment='是否需要展示到新能源专区板块 1 要 2 否')

    def __repr__(self):
        return f"<CarmapTousu(id={self.id}, csName={self.csName}, brand={self.brand}, series={self.series}, model={self.model})>"
